﻿using System.Runtime.InteropServices;

namespace Ast.Core.Pe.Definitions
{
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto, Pack = 1)]
    public struct ImportFunctionDescriptor64 : IImportFunctionDescriptor
    {
        public ulong Value;

        public bool ImportByOrdinal
        {
            get { return Value >> 31 == 1; }
        }

        public uint Ordinal
        {
            get { return (uint) Value & 0xFFFF; }
        }

        public uint HintNameTableRva
        {
            get { return (uint) Value & 0x7FFFFFFF; }
        }

        public uint Size
        {
            get { return 8; }
        }
    }
}